import { Table } from "antd";
import React from "react";

interface IProps {
    dataSource: Array<any>;
    loading: boolean;
}

const View: React.FC<IProps> = props => {
    const columns = [
        {
            title: "username",
            dataIndex: "username",
            key: "username",
            width: 20
        },
        {
            title: "name",
            dataIndex: "name",
            key: "name",
            width: 20
        }
    ];

    return (
        <div style={{ textAlign: "center" }}>
            <h1>USER Manager</h1>
            <Table
                // 设置主键
                rowKey={record => record.username}
                loading={props.loading}
                dataSource={props.dataSource}
                columns={columns}
            />
        </div>
    );
};

export default View;
